<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>closure</title>
    </head>
    <body>
        <script>
            function makeSalary(base) {
                return function () {
                    return base + arguments[0];
                };
            }
            // 定义基础工资数值
            let salaryLevel1 = makeSalary(12000);
            let salaryLevel2 = makeSalary(15000);

            // 传入一个绩效,自动会去计算 基础工资 + 绩效
            console.log(salaryLevel1(3000));
            console.log(salaryLevel1(5000));
        </script>
    </body>
</html>
